package com.ljq.apipassenger.config;

import com.ljq.apipassenger.interceptor.JwtInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new JwtInterceptor()) //添加拦截器
                .addPathPatterns("/**") //拦截路径
                .excludePathPatterns("/noauthTest","/verificationcode/**"); //释放的路径

        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
